﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_REF_SHOP_Get_Search_Count')
	BEGIN
		DROP Procedure usp_UPDMS_REF_SHOP_Get_Search_Count
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_REF_SHOP_Get_Search_Count
**	Desc : 활력업소의 검색결과수를 카운트한다.
**	Test Exec Query : Exec usp_UPDMS_REF_SHOP_Get_Search_Count
**	Called by : Ref_Dac_UPDMS_REF_SHOP.cs
**	Program ID : Ref1010m
**	Auth : 송시명
**	Date : 2013-03-21
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_REF_SHOP_Get_Search_Count]
@ls_category nvarchar(5),
@ls_shop_nm nvarchar(50),
@ls_address nvarchar(200),
@ls_favorite_yn nvarchar(1)
AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SET NOCOUNT ON

SELECT COUNT(Seq) AS Search_Count
  FROM UPDMS_REF_SHOP WITH(NOLOCK)
 WHERE Category LIKE @ls_category + '%'
   AND Shop_Nm LIKE '%' + @ls_shop_nm + '%'
   AND (Address LIKE '%' + @ls_address + '%'
       OR Reserve_Phone LIKE '%' + @ls_address + '%'
       )
   AND Favorite_Yn LIKE @ls_favorite_yn + '%'

GO